{extend name="public/base" /}
{block name="title"}添加节点{/block}

{block name="main"}
<div class="layui-tab" id="Js_title_navigation">
    <ul class="layui-tab-title">
        <li class="layui-this">修改节点</li>
    </ul>
</div>
<form class="layui-form layui-row" action="">
    <input type="hidden" name="id" value="{$menuinfo['id']}" />
    <input type="hidden" name="plat" value="{$plat}" />
    <div class="layui-col-xs12 layui-col-sm8">
        <div class="layui-form-item">
            <label class="layui-form-label">节点名称：</label>
            <div class="layui-input-inline">
                <input type="text" name="menuname" value="{$menuinfo['menuname']}" class="layui-input" lay-verify="required" placeholder="请输入节点名称">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">节点：</label>
            <div class="layui-form-mid">
                {$menuinfo['menuurl']}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">节点：</label>
            <div class="layui-input-inline">
                <select name="pid">
                    {if condition="$menuinfo['depth'] neq 1"}
                        {volist name="menulist.list" id="vo"}
                            <option value="{$vo['id']}" {$vo['id']==$menuinfo['pid']?'selected':''}>{$vo['menuname']}</option>
                        {/volist}
                    {/if}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">节点图标：</label>
            <div class="layui-input-inline">
                <input type="text" name="icon" value="{:str_replace('&','&amp;',$menuinfo['icon'])}" class="layui-input" placeholder="请输入节点图标">
            </div>
            <!-- <i class="layui-form-mid layui-icon showicon">{$menuinfo['icon']}</i> -->
            <a href="javascript:;" class="layui-btn layui-btn-sm" id="iconSelect">复制图标</a>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">节点备注：</label>
            <div class="layui-input-inline">
                <input type="text" name="remark" value="{$menuinfo['remark']}" class="layui-input" placeholder="请输入节点备注">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">节点排序：</label>
            <div class="layui-input-inline">
                <input type="text" name="sort" value="{$menuinfo['sort']}" class="layui-input" lay-verify="number" placeholder="请输入节点排序">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="savemenu">立即提交</button>
                <a href="javascript:;" class="layui-btn layui-btn-primary closeBtn">取消</a>
            </div>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script>
layui.use(['form','iconSelect'], function(){
    var form = layui.form;
    var index = parent.layer.getFrameIndex(window.name);
    form.on('submit(savemenu)',function(obj){
        $.post('/sys/menu/editmenu',obj.field,function(data){
            layer.msg(data.msg);
            if(data.code==1){
                setTimeout(function(){
                    parent.layer.close(index);
                },1000);
            }
        },'json');
        return false;
    });
    $('.closeBtn').click(function(){
        parent.layer.close(index);
    });
    $('#iconSelect').click(function(){
        var iconHtml = iconSelect.getIconHtml();
        var index = layer.open({
            title : "复制图标",
            type : 1,
            area:['550px','400px'],
            content : iconHtml
        });
    });
});
</script>
{/block}